WEBVTT 00:30.000 --> 00:47.680 Hi, my name is Dave Morris and this is my first podcast for HPR. I want to talk to you 00:47.680 --> 00:56.840 on the subject of VIM plugins. I started using VI, Fair Time Ago when I was given the 00:56.840 --> 01:04.040 job of administering a bunch of multi-use, a unique systems. I found that VI was available 01:04.040 --> 01:09.480 on most of these systems. If it wasn't, then the alternative was a thing called 01:09.480 --> 01:17.320 edge, which was appalling. Anyway, whatever happened, EMAX was quite hard to combine. 01:17.320 --> 01:23.120 Certainly wasn't available on the machines out of the box. I'm not quite sure when I moved 01:23.120 --> 01:31.600 from VI to VIM and GIVIM. I might even be as long as 15 years ago. But since then, it's 01:31.600 --> 01:40.840 been my editor of choice and I've tended to use GIVIM and have it configured up as an IDE. 01:40.840 --> 01:47.760 It's not quite as smooth as a purpose-built IDE, but it's not bad as long as you know. 01:47.760 --> 01:55.600 It's a strangeness. Now for this talk, I'm assuming you know the basics of VIM. If you 01:55.600 --> 02:02.480 don't know how to install plugins, then I've pointed you to a very useful article in the 02:02.480 --> 02:09.000 show notes. The show notes all look so tell you where to get each of the plugins. And 02:09.000 --> 02:14.720 you'll notice that some of them have not been updated for a while. But my choice is 02:14.720 --> 02:21.680 the plugins tend to have quite high ratings. So hopefully they'll be useful to you. There are 02:21.680 --> 02:30.560 a few images in the notes, all of which are set up using GIVIM, for example. You need to have 02:30.560 --> 02:37.840 a good read of the help test text for each plugin if you decide to use them. So the 02:37.840 --> 02:43.200 first one I want to talk about is called Nerd Tree. I'm not quite sure where they came up with 02:43.200 --> 02:52.320 that name, but certainly a tree and it's used by this nerd. Anyway, it's a file browser which 02:52.320 --> 03:01.920 when you invoke it tends to sit on the left hand side of your window. I don't know if 03:01.920 --> 03:09.040 I'm assuming you know a bit about VIM Windows. Whatever it splits the main window and drops 03:09.040 --> 03:17.760 itself on the left hand side. You invoke it with a colon command. The colon commands open up the 03:19.120 --> 03:24.960 command line at the bottom of the window. You would type Nerd Tree and it's quite important to get 03:24.960 --> 03:32.960 the capitalization right. It's capital NERDT. Lowercase RW. Then you follow that with the directory 03:32.960 --> 03:42.160 name. I prefer to use Nerd Tree with GIVIM because it tends to be a generally more usable. You can 03:42.160 --> 03:48.960 use the mouse to click on things and scroll it and so on and so forth. Which I just generally 03:48.960 --> 03:56.160 find more usable. There are lots of key mappings within Nerd Tree, far too many to talk about here, 03:56.160 --> 04:02.960 but just give you a flavor. If you put your cursor on a directory in the Nerd Tree itself, 04:03.360 --> 04:10.800 then pressing T will open a new tab with that tree in it so you can be editing multiple files 04:10.800 --> 04:18.400 out of the same directory in different tabs. If you're not up to speed with VIM tabs, then I'll leave 04:18.400 --> 04:24.960 you to do a bit of investigation on that. It's a very, very powerful feature. I definitely recommend 04:24.960 --> 04:32.080 to use it. The other one I use quite a lot is putting the cursor on a directory pressing 04:32.080 --> 04:40.000 lowercase R, will of course the directory to be refreshed. Nerd Tree also offers bookmarks which you 04:40.000 --> 04:47.440 can create through various commands or key sequences which I won't go into. There are lots and 04:47.440 --> 04:54.080 lots of configuration options that you can put in the dot VIM or C file and I've given you some 04:54.080 --> 05:02.800 examples in the show notes where I make sure that Nerd Tree is only invoked when I'm in GVIM mode 05:02.800 --> 05:10.800 and not in standard VIM mode. I'll mention probably mention for every plugin actually the 05:10.800 --> 05:17.600 though the way that you get help, but mostly it's pretty much the same. You would type call on 05:17.600 --> 05:24.720 H or help if you wish H is the abbreviation followed by the name of the plugin and I didn't know 05:24.720 --> 05:29.120 myself actually but just discovered that pretty much all of these plugins don't care about the 05:29.120 --> 05:36.560 case of the the name that you type after the H and that's largely because the authors have made 05:36.560 --> 05:42.640 sure that the relevant tags are in the in the help files that will get you to where you want to be 05:42.640 --> 05:47.920 regardless of what case you you give. The other note though I thought you might be interested in is 05:48.720 --> 05:55.040 if you put your cursor in the Nerd Tree window and press the question mark then you get a quick help 05:55.040 --> 06:06.560 which is a quick abbreviation list of abbreviations for how to use the plugin. Okay so the next one 06:06.560 --> 06:15.920 it's called bash support. It this offers a lot of facilities that you'd expect to find in an 06:15.920 --> 06:25.200 IDE and as you can guess it's specifically designed for working with bash scripts. It adds a menu to 06:25.200 --> 06:31.840 GVIM called bash not surprisingly. Now you can look at the show notes to get an image of 06:31.840 --> 06:39.360 what it what it looks like with the menu open. I use it particularly to start each group with a 06:39.360 --> 06:45.520 standard header so that all of my scripts look pretty much the same contain the same sort of 06:45.520 --> 06:50.960 comments and and that type of thing. You can also do things like maintain a library of code snippets 06:50.960 --> 06:58.960 so you can you can paste into your code so thereby saving you from hunting about all over the place for 06:58.960 --> 07:06.080 ways to do things that you might have forgotten. It can do stuff like check the syntax of a script run 07:06.080 --> 07:13.040 it debug it and as usual there's a whole bunch of keyboard shortcuts. These in general 07:14.080 --> 07:21.600 begin with a backslash so a backslash CT lowercase inserts current date and time at the cursor 07:22.240 --> 07:27.440 which is great for putting time stamps in your in your comments or anything about sort 07:27.440 --> 07:35.280 of code and not too surprisingly help for this is invoked with call on h bash hyphen support 07:35.840 --> 07:41.760 or indeed bash without the hyphen support bash support just as one word so this particular 07:41.760 --> 07:47.040 writer has made sure that lots of tags in the file will get you to where you want to be in the 07:47.040 --> 07:53.760 help text. From the same stable as bash support is another plugin called Pearl support 07:53.760 --> 08:01.040 you're probably gathered that I'm a bash and Pearl scripter spend a fair bit of time writing these 08:01.040 --> 08:08.880 things. This one gives you equivalent facilities for editing Pearl scripts and it adds a Pearl 08:08.880 --> 08:18.000 menu to GVIM. I say that way because there are no menus in standard VIM. It's another bunch 08:18.000 --> 08:27.440 of GVIM of course and again I use it to form standard headers and I've got boiler plate which 08:27.440 --> 08:36.480 will create me a sort of standard empty script that I can then populate. Again you can manage code 08:36.480 --> 08:44.560 snippets with it and it will check syntax run on and debug a script. One of the functions I use 08:44.560 --> 08:52.880 quite a lot and it's called Pearl tidy. This is actually a standalone utility that you can use 08:52.880 --> 09:02.800 for the print when building a pulse script. It's abbreviation is backslase backslashri and what Pearl 09:02.800 --> 09:13.520 tidy does is to reformate your code and it does that according to its own built-in style but you 09:13.520 --> 09:20.960 can you can change that you can adjust it. So you can set up your own personal or house style. If 09:20.960 --> 09:26.720 you're part of a group doing collaborative programming it's it's amazingly important to have 09:26.720 --> 09:34.000 similar style otherwise you find it difficult to read somebody else's code. The way you can figure 09:34.000 --> 09:42.000 it is through a dot Pearl tidy RC file and there's loads of documentation about this. I personally 09:42.000 --> 09:50.320 prefer to use it through GVIM because it's a bit of a hassle to use standalone I find 09:50.320 --> 09:56.800 if to remember more. The other one I use the other part of the pulse pod that I use is Pearl critic. 09:56.800 --> 10:05.040 This is invoked with backslashriPC. This is a thing that does a compliance check with 10:05.040 --> 10:12.880 the best practices book written by Damian Conway is a big name in the Pearl community. 10:14.080 --> 10:20.880 There's an image in the show notes that shows a script being subjected to this. There's a certain 10:20.880 --> 10:28.240 sort of school-marmish feel to the way that it criticizes your code. It's times when you 10:28.880 --> 10:34.000 throw it out the window but on the whole it does some really useful things. You can turn 10:34.000 --> 10:39.920 up and down its level of criticism. Again it's more convenient to use through an editor than it 10:39.920 --> 10:48.400 is to use the standalone version. And finally you can invoke help for Pearl support by typing 10:48.400 --> 10:56.560 call on H Pearl support with or out without the hyphen. Next I want to mention plug-in called 10:56.560 --> 11:04.480 man-page view. Not too surprisingly this allows you to view man pages from within the editor. 11:05.360 --> 11:15.120 You invoke it by typing call on man with capital M, MAN space and then the topic. Or you can 11:15.120 --> 11:23.600 position your cursor on an editing window and press capital K and it will invoke the viewer. 11:23.600 --> 11:29.680 If it can if if the keyword has a man-page entry is relevant to man-page. So once you've got 11:29.680 --> 11:35.120 your man-page up you can search it and scroll it about cut and paste from it which is always 11:35.120 --> 11:39.360 very useful. There'll be good examples often in a man-page that you might want to try out. 11:39.360 --> 11:44.240 I certainly find this amazing in the useful saves hopping out of the editor and going to look at 11:44.240 --> 11:52.960 something on another window perhaps. It's help as usual is invoked with call on H man-page view. 11:54.480 --> 12:02.960 The next plug-in view is called surround. It allows you to add, delete or change so-called surroundings. 12:04.000 --> 12:10.800 By this I mean things like pairs of quotes, pairs of braces, parentheses and so forth. This one 12:10.800 --> 12:17.840 is driven entirely by key sequences. The examples that I've given you some examples in the show notes 12:17.840 --> 12:24.240 because it's it really needs something that you can look at to fully appreciate. But I'll just 12:24.240 --> 12:32.880 see whether I can speak about a couple of them. If your cursor is in an editing window inside a string 12:32.880 --> 12:43.440 enclosed in quotes then if you type ds both lowercase quote and then that's it yeah that's 12:43.440 --> 12:48.560 all your type. If you type that then it just deletes the quote ds quote deletes the quote. 12:48.560 --> 12:58.960 If you're inside a string in brackets square brackets then if you type cs square bracket 12:58.960 --> 13:08.720 closed that's closed square bracket closed parentheses then it will delete the square brackets 13:08.720 --> 13:14.800 and replace with parentheses. So you can see it's actually quite a powerful thing. 13:16.240 --> 13:20.960 Little hard to get your head round but personally I think well worth the trouble. 13:20.960 --> 13:30.240 Again as always you can get lots of help about how to use this with call on h surround. 13:31.760 --> 13:39.600 Next comes fugitive. This is an interface to the get version control system that you can use within 13:39.600 --> 13:47.920 the editor and I've put an example of what what the screen looks like if you type the command 13:47.920 --> 13:56.320 call on capital G status that's the equivalent of the command line get status that shows you the 13:56.320 --> 14:04.640 current state of repository. It gives access to pretty much all of the the get commands through 14:04.640 --> 14:12.640 one means or another either with direct commands or with commands to which you can add arguments. 14:12.640 --> 14:22.560 Again it's help is in book through call on h fugitive. Tag list is my next example. 14:23.760 --> 14:30.800 This is a plugin that lets you help. It gives you help with browsing source code. 14:31.680 --> 14:41.920 It creates a menu within gvm a menu is called tags and when you when you're editing a piece of source 14:41.920 --> 14:51.280 code then you'll find that the tags menu is populated with the functions classes and other major 14:52.480 --> 15:00.560 elements of your source code. You simply need to go to the menu and click on a tag to position 15:00.560 --> 15:09.200 the editor at that particular point. So if you're trying to find a the declaration of a 15:09.200 --> 15:15.680 subroutine whatever language you're dealing with then clicking on it will take you take you there. 15:16.560 --> 15:23.600 Under the hood it uses a package called exuberant c tags which is the most fantastic name 15:24.800 --> 15:33.040 and its job is to build a list of tags so it has syntactic knowledge of a whole bunch of 15:33.040 --> 15:43.200 languages which uses to build a tag file and this is then used by the tag list. There are other 15:43.200 --> 15:51.680 tag features within built into to them which I won't go into now but this I believe gives you 15:51.680 --> 16:01.280 a quite easy route to using this particular feature. There's an image in the show notes that 16:01.280 --> 16:07.760 gives you some idea of what you can do with it and now this there is not been telling you about 16:07.760 --> 16:13.200 how to get the help is that there are a few instances that don't conform to the normal 16:14.000 --> 16:21.280 normal way of doing it and in this this is one particular case. In this case you need to type 16:21.280 --> 16:32.480 call on hspace taglist.txt that's because the tag list is already a name within the standard 16:32.480 --> 16:42.560 them help file so that particular command invokes the things specific for this plugin. 16:42.560 --> 16:50.720 And my last plugin is called super tab. I think this is slightly controversial, 16:52.400 --> 16:58.720 partly because I'm not sure I like it. This provides word completion via the tab key. 16:59.600 --> 17:05.120 There's an example of it doing this in the show notes. So you type at least one character of the 17:05.120 --> 17:10.160 word that you're hoping to type you've forgotten how to spell it or something. You press tab 17:10.160 --> 17:17.600 and pop up menu comes up with the various options that this could be the various words that 17:17.600 --> 17:24.560 could match this. The thing that I'm not sure a like about this is that it hijacks the tab key 17:26.080 --> 17:32.320 and this means that if you want to enter a real tab for a new reason then you need to use control 17:32.320 --> 17:38.000 tab to do it which I'm not sure I want. I would like to be able to switch this on and off as I 17:38.000 --> 17:45.440 need it and I haven't yet found a way of doing it. There are other tab completion plugins available 17:45.440 --> 17:50.480 which I have not tested yet. I think I'm going to do that and see if there's something better 17:50.480 --> 17:59.040 than this. This seems to be the most popular one judging by the rating though. So that's my list of 17:59.040 --> 18:07.360 plugins. This is quite a quick review. There's a lot to be said about each one. Each could have a 18:07.360 --> 18:13.440 podcast to itself, I guess, if anybody would ever listen. The other thing to tell you is there's a 18:13.440 --> 18:21.520 whole world of plugins available on www.vim.org. Very very large and about you can browse through. 18:22.320 --> 18:24.080 So hope you found that useful. 18:29.440 --> 18:33.280 You have been listening to Hector Public Radio as Hector Public Radio does our 18:33.280 --> 18:38.240 we are a community podcast network that releases shows every week that you want to take the 18:38.240 --> 18:45.280 Friday. Today's show by GoR shows was contributed by a HPR listener like yourself. If you ever 18:45.280 --> 18:50.560 consider recording a podcast then visit our website to find out how easy it really is. 18:50.560 --> 18:55.760 Hector Public Radio was founded by the digital.power and the economic and computer cloud. 18:55.760 --> 19:02.080 HPR is funded by the binary revolution at bingreff.com. All bingreff projects across 19:02.080 --> 19:08.000 this sponsored by Lena Pages. From shared hosting to custom private clouds, go to 19:08.000 --> 19:14.720 LenaPages.com for all your hosting needs. On this otherwise stages, today's show is released 19:14.720 --> 19:34.720 on your creative comments at the future. Share and like. He does our life as well.